package me.lxqq.test.web;


import java.util.Random;
import java.util.stream.IntStream;
import java.util.stream.LongStream;

/**
 * 随机数生成器
 * 时间：2018年6月6日09:32:57
 * 作者：lxqq0000
 */
public class RandomHolder {

    public static void nextBytes(byte[] bytes) {
        getInstance().nextBytes(bytes);
    }

    public static int nextInt() {
        return getInstance().nextInt();
    }

    public static int nextInt(int bound) {
        return getInstance().nextInt(bound);
    }

    public static int nextInt(int offset, int bound) {
        return offset + getInstance().nextInt(bound);
    }

    public static long nextLong() {
        return getInstance().nextLong();
    }

    public static boolean nextBoolean() {
        return getInstance().nextBoolean();
    }

    public static IntStream ints(long streamSize) {
        return getInstance().ints(streamSize);
    }

    public static IntStream ints() {
        return getInstance().ints();
    }

    public static LongStream longs(long streamSize) {
        return getInstance().longs(streamSize);
    }

    public static LongStream longs() {
        return getInstance().longs();
    }

    public static Random getInstance() {
        return Instance.random;
    }

    private static class Instance {
        static Random random = new Random(System.currentTimeMillis());
    }

}
